﻿@using NetCore.Model
@{

    ViewData["nav-class"] = "nav nav-third-level";
    var currentUser = ApplicationEnvironments.DefaultSession.GetUser<UserEntity>();
    ViewData["nav-class"] = "nav-second-level";
}
<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="sidebar-collapse">
        <ul class="nav" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element"style="margin-left:50px;">
                    <span>
                        @if (User.Identity.IsAuthenticated)
                        {
                            <img alt="image" class="img-circle avatar_user_pic" src="/api/avatar/@(currentUser!=null?currentUser.UserId:"")" style="width:48px;height:48px;margin-left:5px;cursor:pointer;" data-toggle="modal" data-target="#avatar-modal">
                        }
                        else
                        {
                            <img alt="image" class="img-circle avatar_user_pic" src="/api/avatar">
                        }
                    </span>
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                        <span class="clear">
                            <span class="block m-t-xs" style="padding-left:10px;">
                                <strong class="font-bold">@User.Identity.Name</strong>
                            </span> 
                           <span class="text-muted text-xs block">快捷方式 <b class="caret"></b></span>
                        </span>
                    </a>
                    <ul class="dropdown-menu animated fadeInRight m-t-xs">
                        <li><a asp-area="" asp-action="LogOff" asp-controller="Home">注销</a></li>
                    </ul>
                </div>
                <div class="logo-element">
                    NetCore
                </div>
            </li>
            <li class=" nav-left-menu-link @Html.IsSelectedPage("home/index","",false)" style="border:0;">
                <a asp-action="index" asp-controller="home" asp-area="" >
                    <i class=" fa fa-home"></i>
                    <label>首  页</label>
                </a>
            </li>
            @if (currentUser != null && currentUser.MyPageEntities!=null)
            {
                @await Html.PartialAsync("_ChildNavigation", currentUser.MyPageEntities.Where(x => string.IsNullOrWhiteSpace(x.ParentId)).ToList())
            }
        </ul>
    </div>
</nav>